Preparing and realizing the data transfer via MQTT
The following steps are not required to follow the tutorial "Putting Raspberry Pi into operation". However, you will need the following information when you want to transfer unencrypted data between Raspberry Pis via →MQTT. This possibility is provided by Neuron RTS max starting with version 2.3.1301.
Connecting to Raspberry Pi by using PuTTY
Use PuTTY for the following configuration/installation steps.
-
Start PuTTY.
-
In dialog PuTTY Configuration, enter the detected IP-address under Host Name, select SSH under Connection type, then click Open.
PuTTY displays a terminal window in which you have to enter certain commands – one after each other. Conclude each command by pressing the Enter-key so that the corresponding action is executed.
Configuring Neuron RTS max on the Raspberry Pi
How to configure Neuron RTS max assuming that Neuron RTS max has been installed into this directory: /opt/RTS/PLC
-
Terminate Neuron RTS max on the Raspberry Pi.
-
Within the terminal window of PuTTY: Change into the directory
/opt/RTS/PLC
of the Raspberry Pi.cd /opt/RTS/PLC/
-
Open the file
RTSIO.cfg
in a text editor, change this file and save the changes.nano RTSIO.cfg
Original line Changed line #LoadLibrary RTSS_MQTT
LoadLibrary RTSS_MQTT
In detail:
-
Delete the prefix character
#
in this line. -
Save the changes and exit the editor: Press Ctrl+O (and confirm the file name), then press Ctrl+X.
-
-
Start the Raspberry Pi anew. Neuron RTS max will run after the reboot, if you have added Neuron RTS max to the system start (see under "Installing and starting the runtime system on Raspberry Pi").
Installing/configuring MQTT broker
Transferring data via MQTT requires a MQTT broker. You may install this MQTT broker on any computer or on the Raspberry Pi. Take care that Neuron Power Engineer and the Raspberry Pis are able to access the MQTT broker.
See the user documentation of your MQTT broker, if you need information on installation and/or configuration of this MQTT broker.
Example for a MQTT broker that Neuron is using: the open source software Mosquitto (http://mosquitto.org/). On Debian-based Linux systems, such as Raspbian, the installation of the Mosquitto broker can be performed by entering the following commands as the root user:
|
Controlling the connection for TCP port The MQTT broker is communicating via the default TCP port |
Enhancing the application by MQTT blocks
-
Use the appropriate MQTT blocks in your Neuron Power Engineer application.
-
Load the application onto the Raspberry Pi – this is analogous to the description under "Loading application onto Raspberry Pi".
Analyzing applications that use MQTT blocks
In order to analyze MQTT applications, there are several tools. Neuron uses "MQTT RCP Application" of the "Graphical MQTT Client Tools" of the Paho framework (https://eclipse.org/paho/clients/tool/). By using the program you can determine whether messages have been published to a certain topic on a given MQTT broker. Furthermore, it is possible to subscribe to arbitrary topics.